package com.power.controller;

import com.power.common.Contants;
import com.power.ov.ResultData;
import com.power.service.NeedDealtService;
import com.power.service.impl.NeedDealtServiceImpl;
import com.power.utils.WriterUtil;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;

/**
 * Created with IntelliJ IDEA.
 * User: 朱雄
 * Date: 2020/10/05 17:14
 * Description:
 * Version: V1.0
 */
@WebServlet("/needDealtUpdate.do")
public class NeedDealtUpdateController extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String user_account=req.getParameter("user_account");
        String role_id=req.getParameter("role_id");
        String task_id=req.getParameter("task_id");
        NeedDealtService nds=new NeedDealtServiceImpl();
        ResultData resultData=null;
        try {
           resultData=nds.needDealtUpdate(user_account,role_id,task_id);
        } catch (SQLException e) {
            e.printStackTrace();
            resultData.setCode(Contants.EXCEPTION);
            resultData.setMsg("系统开小差了....");
        }
        WriterUtil.getWriter(resp,resultData);
    }
}
